angular.module('suitDetailModule', ['ionic'])
	.controller("suitDetailCtrl", ["$scope", "$http", "getsuit", "$state", function($s, $h, getd, $state) {
			getd.getdetails()
			.then(function(res){
				$s.suitgood = res.data.data;

				console.log(res.data.data)				
			})
			getd.getdelists()
			.then(function(res){
				$s.getdelists = res.data.data.list;

				console.log(res.data.data.list)				
			})

	}])
	
	.factory("getsuit", function($http,$state) {
		var getdetails = function() {
			return $http.get("/icy/m.php?method=suit.getInfo&needCommentCount=10&needCollectCount=10&isFromApp=1", {
					params: {
						viewUserId: $state.params.userId,
						suitId:$state.params.suitId
					}
				})
				.then(function(res) {
					return res
				})
		};
		var getdelists = function() {
			return $http.get("/icy/m.php?fromPageId=0&pageSize=20&method=suit.getRecommendSuits&page=1", {
					params: {
						viewUserId: $state.params.userId,
						suitId: $state.params.suitId
					}
				})
				.then(function(res) {
					return res
				})
		};
		return {
			getdetails,
			getdelists
		}
	})